# 将Navicat导出来的建表语句按照每个表分隔出不同的SQL文件
with open('./traffic_crm.sql', mode='r', encoding='utf8') as f:
    for sql in f.read().strip().split("-- ----------------------------"):
        sql = sql.strip()
        if sql != '':
            tableName = sql.split(";")[0].split(" ")[-1].replace("`", "")
            with open(f"./mysql_ddl/{tableName}.sql", mode='w', encoding='utf8') as w:
                w.write(sql)